home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kopete / kopetemessagehandlerchain.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  2.5 KB  |  97 lines

  1. /*
  2.     kopetefilterchain.h - Kopete Message Filter Chain
  3.  
  4.     Copyright (c) 2004      by Richard Smith         <kde@metafoo.co.uk>
  5.     Kopete    (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
  6.  
  7.     *************************************************************************
  8.     *                                                                       *
  9.     * This library is free software; you can redistribute it and/or         *
  10.     * modify it under the terms of the GNU Lesser General Public            *
  11.     * License as published by the Free Software Foundation; either          *
  12.     * version 2 of the License, or (at your option) any later version.      *
  13.     *                                                                       *
  14.     *************************************************************************
  15. */
  16.  
  17. #ifndef KOPETEFILTERCHAIN_H
  18. #define KOPETEFILTERCHAIN_H
  19.  
  20. #include <qobject.h>
  21. #include <kdemacros.h>
  22. #include <ksharedptr.h>
  23. #include "kopetemessage.h"
  24. #include "kopetetask.h"
  25.  
  26. namespace Kopete
  27. {
  28.  
  29. class MessageEvent;
  30. class MessageHandler;
  31. class ProcessMessageTask;
  32.  
  33. /**
  34.  * @brief A chain of message handlers; the processing layer between protocol and chat view
  35.  *
  36.  * This class represents a chain of connected message handlers.
  37.  *
  38.  * This class is the client of the chain of responsibility formed by the
  39.  * MessageHandlers, and acts as a facade for that chain, presenting a
  40.  * more convenient interface.
  41.  * 
  42.  * @author Richard Smith       <kde@metafoo.co.uk>
  43.  */
  44. class MessageHandlerChain : public QObject, private KShared
  45. {
  46.     Q_OBJECT
  47. public:
  48.     friend class KSharedPtr<MessageHandlerChain>;
  49.     typedef KSharedPtr<MessageHandlerChain> Ptr;
  50.     
  51.     /**
  52.      * Create a new MessageHandlerChain object with the appropriate handlers for
  53.      * processing messages entering @p manager in direction @p direction.
  54.      */
  55.     static Ptr create( ChatSession *manager, Message::MessageDirection direction );
  56.  
  57.     ProcessMessageTask *processMessage( const Message &message );
  58.     int capabilities();
  59.     
  60. private:
  61.     MessageHandlerChain();
  62.     ~MessageHandlerChain();
  63.     
  64.     friend class ProcessMessageTask;
  65.     class Private;
  66.     Private *d;
  67. };
  68.  
  69. /**
  70.  * @brief A task for processing a message
  71.  * @author Richard Smith       <kde@metafoo.co.uk>
  72.  */
  73. class ProcessMessageTask : public Task
  74. {
  75.     Q_OBJECT
  76. public:
  77.     MessageEvent *event();
  78.     
  79. private slots:
  80.     void slotStart();
  81.     void slotDone();
  82.     
  83. private:
  84.     ProcessMessageTask(MessageHandlerChain::Ptr, MessageEvent *event);
  85.     ~ProcessMessageTask();
  86.     
  87.     friend class MessageHandlerChain;
  88.     class Private;
  89.     Private *d;
  90. };
  91.  
  92. }
  93.  
  94. #endif
  95.  
  96. // vim: set noet ts=4 sts=4 sw=4:
  97.